package com.yun.algorithmproblem.leetcode;

public class Leetcode2269 {

    public static void main(String[] args) {
        Leetcode2269 obj = new Leetcode2269();
        System.out.println(obj.divisorSubstrings(430043, 2));
    }

    public int divisorSubstrings(int num, int k) {
        String s = String.valueOf(num);
        int ans = 0;
        long divK = (long) Math.pow(10,k);
        int divNum = 1;
        for (int i = 0; i <= s.length() - k; i++) {
            int sub = (int) ((num / divNum) % divK);
            if (sub != 0 && num % sub == 0) {
                ans++;
            }
            divNum *= 10;
        }
        return ans;
    }
}
